
<?php
session_start();
$User_ID=$_SESSION['User_ID'];
?>
<?php
$target_dir = "profile_picture/$User_ID/.$User_ID";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$ext = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
       
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],"profile_picture/$User_ID/" . $User_ID.".".$ext);//actually reponsible for copying file in new folder

$filenameimage="../upload_image/" . $User_ID.".".$ext;
$actualimageurl="../upload_image/" . $_FILES["fileToUpload"]["name"];
	 $message = "Uploading Profile Picture Successful!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php?page=1&pet_id=';</script>";

    } else {
          $message = "Uploading Profile Picture Failed.!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php?page=1&pet_id=';</script>";
    }
}


?>


<?php

require_once("includes/database.php"); 


{	


$tsql="UPDATE user_db SET Profile_Picture= '{$User_ID}/{$User_ID}.{$ext}'
WHERE User_ID='{$User_ID}'";

//sendEmail(getEmail($owner_User_ID_add),"Updated Immunization Date","From Petformance");

$data =  mysql_query($tsql,$con);

if( $data )
{
    /*echo "Connection established.\n";*/

}
else
{
 
     die( print_r( mysql_error(), true));
}
}

?>